package com.example.sunsg.okhttptest.customview;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.Button;
import android.widget.ImageView;

/**
 * Created by sunsg on 16/12/16.
 */
public class TouchView1 extends ImageView{

    public TouchView1(Context context) {
        super(context);
    }

    public TouchView1(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public TouchView1(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {


        switch (event.getAction()){
            case MotionEvent.ACTION_DOWN:
                Log.i("test","\nTouchView1 dispatchTouchEvent down\n");
                break;
            case MotionEvent.ACTION_MOVE:
//                Log.i("test","\nTouchView1 dispatchTouchEvent ACTION_MOVE\n");
                break;
            case MotionEvent.ACTION_UP:
                Log.i("test","\nTouchView1 dispatchTouchEvent ACTION_UP\n");
                break;
        }
        return super.dispatchTouchEvent(event);
//        return true;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {

        switch (event.getAction()){
            case MotionEvent.ACTION_DOWN:
                Log.i("test","\nTouchView1 onTouchEvent down\n");
                break;
//                return true;
            case MotionEvent.ACTION_MOVE:
//                Log.i("test","\nTouchView1 onTouchEvent ACTION_MOVE\n");
                break;
            case MotionEvent.ACTION_UP:
                Log.i("test","\nTouchView1 onTouchEvent ACTION_UP\n");
//                return false;
                break;
        }
        return super.onTouchEvent(event);
//        return true;
    }
}
